local LM = require "packages/luming/LM"

--仅自己可见的将领mark，负责显示将领池等一些东西
--后继带&前缀则为将领池，否则默认为将领牌区
Fk:addQmlMark{
  name = "lm_servants",
  qml_path = function(name, value, p)
    if string.startsWith(name, "@[lm_servants]&") then
      if Self == p then
        return "packages/luming/qml/LM_ViewGeneralPile" -- 就不需要那么花里胡哨了
      else
        return ""
      end
    end
    return "packages/luming/qml/LM_ViewServants"
  end,
  how_to_show = function(name, value, p)
    if type(value) ~= "table" then return "#hidden" end
    if string.startsWith(name, "@[lm_servants]&") then
      if Self == p then return tostring(#value) end
      return "#hidden"
    else
      local svts = value
      if svts then
        local max = LM.getServantsMax(p)
        local num = LM.getServantsOccupied(p)
        return string.format("%d / %d", num, max)
      end
    end
    return "#hidden"
  end,
}
